﻿using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using W.Warehouse.Api.Application.Command.BinLocationCommand;
using W.Warehouse.Api.Application.Command.WarehouseCommand;
using W.Warehouse.Api.Application.Command.WarehouseTypeCommand;
using W.Warehouse.Domain;

namespace W.Warehouse.Api.Controllers
{
    /// <summary>
    /// 库位管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class BinLocationController : ControllerBase
    {
        private readonly IMediator _mediator;
        public BinLocationController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 添加库位管理
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddBinLocation(BinLocationCreateCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 删除库位管理
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> DelectBinLocation(BinLocationDelectCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 批量删除库位管理
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> DelectRangeBinLocation(BinLocationDelectRangeCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 修改库位管理
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> UpdateBinLocation(BinLocationUpdateCommand command)
        {
            return await _mediator.Send(command);
        }
    }
}
